<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="build/select-box.js"></script>
</head>
<body>
<div id="container"></div>
<script>
    var data = [
        {name: "深圳", id: "CT_SZ"},
        {name: "湖南", id: "CT_HN"},
        {name: "好吧", id: "CT_HB"}
    ]

    var selectBox = new SelectBox({
        fetchUrl: "./data.json",
        addPostUrl: "./add-url",
        defaultDataTitle: "热门城市",
        defaultData: [{name: "北京", id: "CT_BJ"}, {name: "上海", id: "CT_SH"}],
        displayNameKey: "name",
        valueKey: "id",
        selectedHandle: function(result) {
            alert(result.val +"  " + result.displayName);
        }
    }
    );
    selectBox.render("container");
</script>

</body>
</html>